import React,{Component} from "react";


const Style={
  icon:{
    width:20,
    height:20,
    fill: "currentColor",
    overflow: "hidden",
    verticalAlign:"middle"
  }
};

export default class IconFont extends Component{
// props
//  name  字体名称
//  color
//  className

  constructor(props){
    super(props);
    this.state={};
  }

  render() {
    const className = this.props.className?this.props.className:null;
    const style    = Object.assign(
      {},
      Style.icon,
      this.props.style?this.props.style:{},
      this.props.color?{color:this.props.color}:{},
      this.props.size?{width:this.props.size,height:this.props.size}:{}
    );
    return <svg className={className} style={style} aria-hidden="true"><use xlinkHref={"#".concat(this.props.name)}></use></svg>;
  }
}



